package com.fenghongzhang.day008test;

import android.os.Bundle;

import androidx.fragment.app.Fragment;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;


/**
 * A simple {@link Fragment} subclass.
 */
public class LoginFragment extends Fragment {
    private Button btn;

    public LoginFragment() {
        // Required empty public constructor
    }


    public interface MyListener{
        void send(int i);
    }

    private MyListener listener;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View inflate = inflater.inflate(R.layout.fragment_login, container, false);
        btn = (Button) inflate.findViewById(R.id.btn);

        listener = (MyListener) getActivity();

        btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //打开注册fragment
//                vp.setCurrentItem(1);
                listener.send(1);

            }
        });

        return inflate;
    }
}
